package com.FH.login;

import org.codehaus.jettison.json.JSONObject;

import java.util.Date;

/**
 * Created by administor on 2017/1/13.
 */
public class Oauth {
    private String token;
    private String pwMd5;
    //@Autowired
   // private DemainUser demainUser;
    public String getAccessToken(String username,String password) {
        token = MD5Utils.processMD5(username)
                +MD5Utils.processMD5(password)+ ToolsUtils.getCurrentDateTime(new Date());
        return token;
    }

    public JSONObject changeToJson(String username, String password) throws Exception{
        JSONObject rquestObject = new JSONObject();
        String token= getAccessToken(username,password);
        rquestObject.put("userName",username);
        rquestObject.put("userPassword",password);
        rquestObject.put("token",token);
        return rquestObject;
    }
}
